package com.me.myHungTrung;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.Texture.TextureFilter;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
import com.badlogic.gdx.graphics.g2d.TextureRegion;

public class Assets {
	static TextureAtlas atlas;
	public static TextureRegion[] chickImage;
	public static TextureRegion[] eggImage;
	public static TextureRegion background, help;
	public static TextureRegion bag;
	public static BitmapFont largeFont, midFont, specFont;
	
	public static void load(){
		try{
			atlas = new TextureAtlas(Gdx.files.internal("data/image.atlas"));
			background = atlas.findRegion("background");
			help = atlas.findRegion("help");
			bag = atlas.findRegion("ro");
			
			//load hinh ga, vit, ngan
			chickImage = new TextureRegion[3];
			for(int i = 0; i < 3; i++){
				chickImage[i] = atlas.findRegion("chick" + i );
			}
			
			//load hinh trung, phan
			eggImage = new TextureRegion[2];
			eggImage[0] = atlas.findRegion("egg0");//trung
			eggImage[1] = atlas.findRegion("egg1");//phan
			
			largeFont = new BitmapFont(Gdx.files.internal("data/defaultLargerFont.fnt"), Gdx.files.internal("data/defaultLargerFont.png"), false);
			midFont = new BitmapFont(Gdx.files.internal("data/defaultMidFont.fnt"), Gdx.files.internal("data/defaultMidFont.png"), false);
			specFont = new BitmapFont(Gdx.files.internal("data/LargeFont.fnt"), Gdx.files.internal("data/LargeFont.png"), false);
		}catch(Exception ex){
//			System.out.println("nullllll");
		}
	}
	
	public static TextureRegion getChickImage(int index){
		return chickImage[index];
	}
	
	public static TextureRegion getEggImage(int index){
		return eggImage[index];
	}
	
	public static void dispose(){
		atlas.dispose();
		largeFont.dispose();
		midFont.dispose();
		specFont.dispose();
	}
}
